Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the option for the external force orientation to be reperesented in the link frame #463

Conversation

HosameldinMohamed
Copy link
Contributor

@HosameldinMohamed HosameldinMohamed commented Jan 28, 2020

Proposed feature to add:

Where the user can write a command:

orient_local

And the mode will change to "orient_local" where the applied forces will have the orientation of the link frame. Moreover, the user will specify the force components w.r.t the link frame.

Writing the command:

orient_global

Will switch to the already implemented settings.

  • The default setting is orient_global.

Related issue: #462

Other modification:

Before: If the user writes any 1-word command other than single, the mode is switched to multiple wrenches mode (see #418).

After: If the user commands any 1-word command other than single, multiple, orient_global, orient_local, they will receive an error and a message:

ERROR: Incorrect command format. Insert [help] to know the correct command format

Copy link
Member

@traversaro traversaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Preliminary comments, I did not reviewed all of the PR.

Can you update the CHANGELOG.md file? Thanks!

@HosameldinMohamed
Copy link
Contributor Author

HosameldinMohamed commented Jan 28, 2020

Can you update the CHANGELOG.md file? Thanks!

Done in 6a7134d and a conflict in CHANGELOG.md was resolved.

@traversaro
Copy link
Member

Thanks @HosameldinMohamed ! I will probably need a bit of help with the math, either @prashanthr05 or @Yeshasvitvs can help me on that? Thanks!

this->m_reply.addString ( "Insert [single] or [multiple] to change the operation mode" );
this->m_reply.addString ( "The default frame orientation is the one of the base/root frame ([orient_global])" );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it one of the base/root frame or the world frame? The words base/root and global seem to not to go along well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're right it's confusing. However the phrase "The default frame orientation is the one of the base/root frame" was written before and I didn't want to change it even though the applied force's frame seems to have the orientation of the global one.

Check out this little demo where I apply forces in X,Y and Z directions in global_orient mode:
Peek 2020-02-16 17-21

@@ -147,7 +147,7 @@ void ExternalWrench::applyWrench()
ignition::math::Vector3d newY = newZ.Cross (newX);
ignition::math::Matrix4d rotation = ignition::math::Matrix4d (newX[0],newY[0],newZ[0],0,newX[1],newY[1],newZ[1],0,newX[2],newY[2],newZ[2],0, 0, 0, 0, 1);
ignition::math::Quaterniond forceOrientation = rotation.Rotation();
ignition::math::Pose3d linkCoGPose (linkCoGPos - rotation*ignition::math::Vector3d ( 0,0,.15 ), forceOrientation);
ignition::math::Pose3d W_p_F (linkCoGPos - rotation*ignition::math::Vector3d ( 0,0,.15 ), forceOrientation);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A pose can be identified with H or T. Here W_p_F is confusing as to a position and not a Pose.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And why the variable naming W_p_F ? Anyways the force are applied to the CoG of the link right? Only the visual is offset by these magic numbers?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A pose can be identified with H or T. Here W_p_F is confusing as to a position and not a Pose.

Right, in the next commit I have changed the abbreviations to be more clear. Considering only Transformation T, Rotation R, or Position P.

And why the variable naming W_p_F ? Anyways the force are applied to the CoG of the link right? Only the visual is offset by these magic numbers?

I have changed the name of the variable to more clear and explicit name.

plugins/externalwrench/src/ExternalWrench.cc Outdated Show resolved Hide resolved
plugins/externalwrench/src/ApplyExternalWrench.cc Outdated Show resolved Hide resolved
plugins/externalwrench/src/ExternalWrench.cc Outdated Show resolved Hide resolved
plugins/externalwrench/src/ExternalWrench.cc Show resolved Hide resolved
plugins/externalwrench/src/ExternalWrench.cc Show resolved Hide resolved

math::Vector3d linkCoGPos = link->WorldCoGPose().Pos(); // Get link's COG position where wrench will be applied
math::Vector3d newZ = force.Normalized(); // normalized force. I want the z axis of the cylinder's reference frame to coincide with my force vector
math::Vector3d newX = newZ.Cross (math::Vector3d::UnitZ);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we consider here the UnitZ of the Gazebo world ? or the UnitZ of the link?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the current setting is OK (in Gazebo world). Since UnitZ is used to construct the transformation from the applied force frame to the Link CoG frame (Lg_T_F), which then is multiplied to the transformation between the world frame and the Link CoG frame:

        ignition::math::Matrix4d W_T_F = W_T_Lg*Lg_T_F;

In this line for example.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@traversaro
Copy link
Member

Hi @HosameldinMohamed , what is the status of this PR?

@HosameldinMohamed
Copy link
Contributor Author

Hi @HosameldinMohamed , what is the status of this PR?

Hi @traversaro , it's pending me addressing to some of @prashanthr05 comments and a discussion we had. I'll do it very soon.

@traversaro
Copy link
Member

@HosameldinMohamed @prashanthr05 if we do not have plans to continue on this PR in the short term, we can always close it and re-open it again once we want to work on it again.

@HosameldinMohamed
Copy link
Contributor Author

@HosameldinMohamed @prashanthr05 if we do not have plans to continue on this PR in the short term, we can always close it and re-open it again once we want to work on it again.

Hi @traversaro Right. I don't think I will be able to work on this PR in the short term. So I close it for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants